import express from "express"; 
import * as bodyParser from "body-parser"
import { createRouter } from "./DbUserRouter";

export async function init(): Promise<void> {
    let port = 8753;  // 端口号
    const app = express();  // 初始化 express
    app.use(bodyParser.urlencoded({ extended: true }));
    app.use(bodyParser.json());
    app.use('/user/', await createRouter());   // 添加路由
    app.all("/", (req, res) => {
        res.send("Hello World!");
    })
    // 监听端口
    app.listen(port, () => {
        console.log(`Application has started on Port ${port}`);
    });
}
